package controllers;

import java.io.File;

import models.Book;
import play.Play;
import play.mvc.Controller;

public class BookDetails extends Controller {
	public static void show(long id){
		Book book = Book.findById(id);
		render(book);
	}
	
	public static void getBookThumbnail(long id) {
		Book book = Book.findById(id);
		if (book.image.exists()){
			renderBinary(book.image.get());
		}else{		
			String path = Play.applicationPath + "/public/images/book-icon.png";
			renderBinary(new File(path));
		}
	}
}
